package com.example.codequalityservice.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;

/**
 * @author DestinyCc
 * @date 2022/4/19
 */
@Configuration
@Component
public class ScheduleConfig implements SchedulingConfigurer {
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        //显式为Scheduler指定线程池并且设定线程池基本大小为8
        taskRegistrar.setScheduler(Executors.newScheduledThreadPool(8));
    }
}